<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:r="http://ricchieri.com/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
	<ui:composition template="../../templates/commonLayoutOther.xhtml">
		<ui:define name="title">#{msg.titleOther}</ui:define>
		<ui:define name="content">
		     <h:form id="searchCharterForm">
		     	<p:messages showDetail="false" autoUpdate="true" closable="false"/>    
	     		<h2>#{msg.searchCharter}</h2>   
		     	<h:panelGrid columns="2">
		     	
		     		<h:outputLabel value="#{msg.charterNumber}" />
		     		<p:inputText value="#{searchCharterMB.charterNumber}" maxlength="3" onkeypress="if(event.which &lt; 48 || event.which &gt; 57) return false;"/>
		     		
		     		<h:outputLabel value="#{msg.charterPatent}" />
		     		<p:inputText value="#{searchCharterMB.charterFilter.patent}" maxlength="6"/>
		     		
		     		<h:outputLabel value="#{msg.charterType}" />
		     		<p:selectOneMenu id="charterType" value="#{searchCharterMB.charterFilter.charterType}">
						<f:selectItem itemLabel="#{msg.defaultComboValue}" itemValue="" />
						<f:selectItems value="#{searchCharterMB.charterTypes}" />
					</p:selectOneMenu>

				</h:panelGrid>
				<h:panelGrid columns="2" style="margin-top:10px; text-align:center">
	     			<r:commandLinkCustom id="reset" action="#{searchCharterMB}" method="reset" icon="icon-eraser" message="#{msg.resetButton}"/>
	     			<r:commandLinkCustom id="search" action="#{searchCharterMB}" method="search" icon="icon-search" message="#{msg.searchButton}"/>
	     	 	</h:panelGrid>
	     	 	
	     	 	<p:blockUI block="charterTable" trigger="charterTable">  
			        #{msg.loading}<br />  
			        <p:graphicImage value="/images/ajax-loader.gif"/>  
			    </p:blockUI>  
	     	 	
	     	 	<p:dataTable var="charter" value="#{searchCharterMB.charterLazyDataModel}" 
	     	 		rendered="#{searchCharterMB.charterLazyDataModel != null}"  id="charterTable"
	     	 		style="padding-top:15px" rows="10" paginator="true" lazy="true"
	     	 		paginatorPosition="bottom" emptyMessage="#{msg.noRecordsFound}">

	 		 		<p:column headerText="#{msg.charterNumber}" style="width:15%" sortBy="#{charter.charterNumber}">  
		            	<h:outputText value="#{charter.charterNumber}" />   
	        		</p:column> 
	        				 
	 		 		<p:column headerText="#{msg.charterPatent}" style="width:15%" sortBy="#{charter.patent}">  
		            	<h:outputText value="#{charter.patent}" />   
	        		</p:column> 
	 
	 				<p:column headerText="#{msg.charterType}" style="width:7%" >  
		            	<h:outputText value="#{searchCharterMB.obtainDescription(charter.charterType.description)}" />   
	        		</p:column> 
	        		
			        <p:column headerText="#{msg.charterDate}" style="width:20%" sortBy="#{charter.start}">  
		            	<h:outputText value="#{searchCharterMB.formatDate(charter.start)}" />   
	        		</p:column> 
	        		
	        		<p:column headerText="#{msg.charterPlaces}" style="width:10%" sortBy="#{charter.places}">  
		            	<h:outputText value="#{charter.places}" />   
	        		</p:column> 
	        		<p:column headerText="#{msg.actions}" style="width:40%">
	        			<center>
	        				<h:commandLink action="#{searchCharterMB.viewCharter(charter)}" ajax="false" process="@form">
	        					<i class="icon-zoom-in icon-2x color-zoom"></i>
	        				</h:commandLink>
	        				<r:space/><r:space/>
	        				
	        				<h:commandLink action="#{searchCharterMB.editCharter(charter)}" ajax="false" process="@form">
	        					<i class="icon-edit icon-2x color-edit"></i>
	        				</h:commandLink>
							<r:space/><r:space/>
							
	        				<p:commandLink oncomplete="deleteCharter.show();" action="#{searchCharterMB.showDialog(charter)}">
	        					<i class="icon-remove-sign icon-2x color-delete"></i>
	        				</p:commandLink>
	        				<r:space/><r:space/>
	        				
	        				<h:commandLink action="#{searchCharterMB.addCharterExpense(charter)}" ajax="false" process="@form">
	        					<i class="icon-money icon-2x color-cost"></i>
	        				</h:commandLink>
	        			</center>
	        		</p:column>  
			    </p:dataTable>
	     	 	
	     	 	
	     	 	
	     	 	<p:confirmDialog id="confirmDialogDel" message="#{msg.deleteMessage}"  
			                header="#{msg.deleteProcessHeader}" severity="alert" widgetVar="deleteCharter"> 
			    	<center> 
			        	<p:commandButton id="confirmdelete" value="#{msg.yesMessage}" oncomplete="deleteCharter.hide()" action="#{searchCharterMB.delete()}" update="@form" partialSubmit="true" process="@form" />  
			        	<p:commandButton id="declinedelete" value="#{msg.noMessage}" oncomplete="deleteCharter.hide()" action="#{searchCharterMB.unselect()}"/>     
			    	</center>       
			    </p:confirmDialog>  
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>
